cc.Class({
    extends: cc.Component,

    properties: {
        btnReturn: cc.Button,
        levelItem: cc.Prefab,
        levelContent: cc.Node,
        page1:cc.Node,
        page2:cc.Node,
    },

    onLoad() {
        this.createGameLevel();
    },

    //返回
    onBtnReturnCheckEvent: function () {
        window.audioMgr.prototype.playButtonAudio();
        removeNodeByParent(this.node)
       
    },

    //创建关卡列表
    createGameLevel: function () {
        let levelData = window.gameLevelData.data;
        for (let i = 0; i < levelData.length; i++) 
        {
            let pfLevel = window.creatrPrefab(this.levelItem);
            let levelItem = pfLevel.getComponent("levelItem");
            levelItem.setLevel(i, levelData[i]);
            levelItem.pfLevel = this;
            if(i < 20)
            {
                this.page1.addChild(pfLevel);
            }
            else
            {
                this.page2.addChild(pfLevel);
            }
           
        }
    },
});